/**
 * 加载redis资源
 */

function loadAllSelectVal_redis()
{
	var arr = ["abb1", "zhixingxingzhi_mz", "bbx1_zhongyaoyongfa_mz", "acx1_zhongyaojiaozhu_mz", "bbx1_zhongyaojianfa_mz", "bdi1_zhongyao_pinci_mz", "bbx1_fujiashoushu_mz", "bbx1_mazui_mz", "bdi1_xiyao_pinci_mz", "biw1_yongyaomudi_mz", "bce1_shoushurenyuan_mz", "bdi1_qitapinci_mz", "cag1_jibing_mz", "bbx1_geiyaotujing_mz"];
	$.ajax(
			{
			url : rootUrl + "/clidoctor/getRedisResource",
			type : 'get',
			dataType : 'json',
			async : false,
			success : function(data)
			{
				var map = data.map;
				// 给药途径
				var geiyaotujingList = map["bbx1_geiyaotujing_mz"];
				geiyaoHtml = "<select class='geiyaoHtml' onchange='getGeiyaoZhixing()'>";
				for (var j = 0; j < geiyaotujingList.length; j++)
				{
					geiyaoHtml = geiyaoHtml + "<option id='" + geiyaotujingList[j]["bbx01"] + "',name='" + geiyaotujingList[j]["bbx01"] + "'>";
					geiyaoHtml = geiyaoHtml + geiyaotujingList[j]["bbx05"];
					geiyaoHtml = geiyaoHtml + "</option>";
				}
				geiyaoHtml += "</select>";

				// 西药诊疗频次
				var zhenLiaoPinCiList = map["bdi1_xiyao_pinci_mz"];
				zhenLiaoPinCiHtml = "<select class='zhenLiaoPinCiHtml'  onchange='jisuanZongliang()'>";
				for (var k = 0; k < zhenLiaoPinCiList.length; k++)
				{
					zhenLiaoPinCiHtml = zhenLiaoPinCiHtml + "<option id='" + zhenLiaoPinCiList[k]["bdi06"] + "' name='" + zhenLiaoPinCiList[k]["bdi01"] + "' value='" + zhenLiaoPinCiList[k]["bdi08"] + "'>";
					zhenLiaoPinCiHtml = zhenLiaoPinCiHtml + zhenLiaoPinCiList[k]["bdi02"];
					zhenLiaoPinCiHtml = zhenLiaoPinCiHtml + "</option>";
				}
				zhenLiaoPinCiHtml += "</select>";

				// 执行性质
				var xingzhilist = map["zhixingxingzhi_mz"];
				zhiXingXingZhiHtml = "<select class='zhiXingXingZhiHtml'>";
				for (var k = 0; k < xingzhilist.length; k++)
				{
					zhiXingXingZhiHtml += "<option id='" + xingzhilist[k]["fid"] + "' value='" + xingzhilist[k]["fid"] + "'>";
					zhiXingXingZhiHtml += xingzhilist[k]["fname"];
					zhiXingXingZhiHtml += "</option>";
				}
				zhiXingXingZhiHtml += "</select>";

				// 中药频次
				var zhenLiaoPinCiList = map["bdi1_zhongyao_pinci_mz"];
				zhenLiaoPinCiHtml2 = "<select class='zhenLiaoPinCiHtml2'>";
				for (var k = 0; k < zhenLiaoPinCiList.length; k++)
				{
					zhenLiaoPinCiHtml2 = zhenLiaoPinCiHtml2 + "<option value='" + zhenLiaoPinCiList[k]["bdi06"] + "',name='" + zhenLiaoPinCiList[k]["bdi01"] + "',id='" + zhenLiaoPinCiList[k]["bdi08"] + "'>";
					zhenLiaoPinCiHtml2 = zhenLiaoPinCiHtml2 + zhenLiaoPinCiList[k]["bdi02"];
					zhenLiaoPinCiHtml2 = zhenLiaoPinCiHtml2 + "</option>";
				}
				zhenLiaoPinCiHtml2 += "</select>";

				// 加载中药脚注
				var jiaozhulist = map["acx1_zhongyaojiaozhu_mz"];
				zhongyaojiaozhuHtml = "<select class='zhongyaojiaozhuHtml'>";
				for (var i = 0; i < jiaozhulist.length; i++)
				{
					zhongyaojiaozhuHtml += "<option value='" + jiaozhulist[i]["acx01"] + "'>";
					zhongyaojiaozhuHtml += jiaozhulist[i]["acx02"];
					zhongyaojiaozhuHtml += "</option>";
				}
				zhongyaojiaozhuHtml += "</select>";

				// 中药煎法
				var jianfalist = map["bbx1_zhongyaojianfa_mz"];
				zhongyaojianfaHtml = "<select class='zhongyaojianfaHtml'>";
				for (var i = 0; i < jianfalist.length; i++)
				{
					zhongyaojianfaHtml += "<option value='" + jianfalist[i]["bbx01"] + "'>";
					zhongyaojianfaHtml += jianfalist[i]["bbx05"];
					zhongyaojianfaHtml += "</option>";
				}
				zhongyaojianfaHtml += "</select>";

				// 中药用法
				var yfList = map["bbx1_zhongyaoyongfa_mz"];
				zhongyaoyongfaHtml = "<select class='zhongyaoyongfaHtml'>";
				for (var i = 0; i < yfList.length; i++)
				{
					zhongyaoyongfaHtml += "<option value='" + yfList[i]["bbx01"] + "'>";
					zhongyaoyongfaHtml += yfList[i]["bbx05"];
					zhongyaoyongfaHtml += "</option>";
				}
				zhongyaoyongfaHtml += "</select>";

				// 样本列表
				yangbenList = map["abb1"];
				jyyangbenleixing = "<select class='jyyangbenleixing'>";
				for (var j = 0; j < yangbenList.length; j++)
				{
					jyyangbenleixing += "<option value='" + yangbenList[j]['abb01'] + "' >" + yangbenList[j]['abb02'] + "</option>";
				}
				jyyangbenleixing += "</select>";

				// 手术附加项目
				var rList = map["bbx1_fujiashoushu_mz"];
				if (rList.length)
				{
					fujianshoushuListHtml = "<select class='fujianshoushuListHtml form-control'>";
					for (var i = 0; i < rList.length; i++)
					{
						var id = rList[i].bda01 + '|' + rList[i].bbx01 + '|' + rList[i].bbx04 + "|";
						var txt = rList[i].bbx05 + "|" + (rList[i].bdg02 == undefined ? "" : rList[i].bdg02) + "|" + (rList[i].ach02 == undefined ? "" : rList[i].ach02);
						fujianshoushuListHtml += "<option id='" + id + "'>" + txt + "</option>";
					}
					fujianshoushuListHtml += "</select>";
				}

				// 手术麻醉项目
				var mazuiList = map["bbx1_mazui_mz"];
				for (var i = 0; i < mazuiList.length; i++)
				{
					var id = (mazuiList[i].bda01 == undefined ? 0 : mazuiList[i].bda01) + '|' + mazuiList[i].bbx01;
					mazuiHtml += '<div class="checkbox"><label>';
					mazuiHtml += '<input type="checkbox"  style=" position: relative;"  value=' + id + '><span>';
					mazuiHtml += mazuiList[i].bbx05;
					mazuiHtml += '</span></label></div>';
				}

				// 用药目的
				var yongyaolist = map["biw1_yongyaomudi_mz"];
				yongyaomudiHtml = "<select class='yongyaomudiHtml'>";
				for (var i = 0; i < yongyaolist.length; i++)
				{
					yongyaomudiHtml += "<option value=" + yongyaolist[i]["biw01"] + ">" + yongyaolist[i]["biw02"] + "</option>";
				}
				yongyaomudiHtml += "</select>";
				
				//手术人员列表
				var shoushurenyaunlist = map["bce1_shoushurenyuan_mz"];
				shoushurenyuanHtml = "<select class='shoushurenyuanHtml'>";
				shoushurenyuanHtml+='<option value="">--请选择--</option>';
				for(var i = 0;i<shoushurenyaunlist.length;i++)
				{
					shoushurenyuanHtml += "<option value='"+shoushurenyaunlist[i]["bce01"]+"'>"+shoushurenyaunlist[i]["bce03"]+"</option>";
				}
				shoushurenyuanHtml += "</select>";
				
				//其它医嘱频次
				var otherPincilist = map["bdi1_qitapinci_mz"];
				otherPinciHtml = "<select class='otherPinciHtml'>";
				for(var i = 0;i<otherPincilist.length;i++)
				{
					otherPinciHtml += "<option id='"+otherPincilist[i]["bdi06"]+"' value='"+otherPincilist[i]["bdi01"]+"' name='"+otherPincilist[i]["bdi08"]+"'>"+otherPincilist[i]["bdi02"]+"</option>";
				}
				otherPinciHtml += "</select>";
				
                ////////////////////////////////////////////////////华丽的分割线///////////////////////////////////////////////////
				///////////////////////////非redis数据
				//给药执行
				var url21 = rootUrl+"/treatment/geiyaokeshiList";
				$.ajax({url:url21,data:{},dataType:"json",type:'get',async:false,success:function(data){
					var list = data.list;
					geiyaozhixingListHtml = "<select class='geiyaozhixingListHtml'>";
					for(var i = 0;i<list.length;i++)
					{
						if(list[i]["bck01"]==bck01)
						{
							geiyaozhixingListHtml += "<option value='"+list[i]["bck01"]+"' selected='selected'>"+list[i]["bck03"]+"</option>";
						}
						else
						{
							geiyaozhixingListHtml += "<option value='"+list[i]["bck01"]+"'>"+list[i]["bck03"]+"</option>";
						}
					}
					geiyaozhixingListHtml += "</select>";
				}});
				
				//病人常用诊断
				var url8 = rootUrl+"/treatment/querypatienttreatmentrecord";
				var params8 = {};
				params8.vaa01 = vaa01;
				params8.acf01 = 1;
				params8.vaa07 = vac01;
				params8.currPage = 1;
				params8.pageSize = 10;
				$.ajax({url:url8,data:params8,dataType:'json',async:true,type:'post',success:function(data)
				{
					bingrenVaoList = data.list;
				}});
				
				//执行科室
				var url9 = rootUrl+"/basicinformationquery/zhixingkeshi1";
				$.ajax({url:url9,data:{},dataType:"json",type:'get',async:false,success:function(data){
				{
					var list = data.list;
					zhixingkeshi1Html = "<select class='zhixingkeshi1Html'>";
//					zhixingkeshi1Html+='<option value="">--请选择--</option>';
					for(var i = 0;i<list.length;i++)
					{
						zhixingkeshi1Html += "<option value='"+list[i]["bck01"]+"'>"+list[i]["bck03"]+"</option>";
					}
					zhixingkeshi1Html += "</select>";
					
				}}});
				
				$.ajax({
					url: rootUrl+"/patientsearch/finddepartments",
					type: "get",
					dataType:'json',
					async:false,
					data:{"bce01":bce01},
					success:function(data){
						var departmentList = data.list;
						bck01ListHtml="<select class='bck01ListHtml'>";
						for(var i = 0; i<departmentList.length; i++)
						{
							if(departmentList[i]["bck01"]==bck01)
							{
								bck01ListHtml += "<option value=\""+departmentList[i]["bck01"]+"\" selected=selected>" + departmentList[i]["bck03"] + "</option>";
							}
							else
							{
								bck01ListHtml += "<option value=\""+departmentList[i]["bck01"]+"\">" + departmentList[i]["bck03"] + "</option>";
							}
						}
						bck01ListHtml += "</select>";
//						 $('.bck01ListHtml').select2(
//									{
//										placeholder : '一次性',
//										allowClear : true,
//									})
					}
					});
			}
			});
}